package com.wk.kxexamadminister.utils;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
// 上传
public class uploadUtils {

    public static String uploadFile(MultipartFile fileName){
        if(fileName.isEmpty()){
            return "未选择文件";
        }

        String originalFilename = fileName.getOriginalFilename();
        String path = "C:\\Users\\ASUS\\Desktop/";
        File file = new File( path + originalFilename);
        try {
            //fileName.transferTo(file);
            return file.getAbsolutePath();
        }catch (Exception e){
            e.printStackTrace();
            return "上传失败";
        }

    }



}
